]> dgit.raspbian.org Git - gnome-shell.git/commit
inputMethod: Check for surrounding text before enabling that capability
authorTakao Fujiwara <tfujiwar@redhat.com>
Sun, 9 Mar 2025 00:40:36 +0000 (09:40 +0900)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 15 Apr 2025 12:26:11 +0000 (12:26 +0000)
commit50caec30fd4de5786f6bc01230d44e88a8839976
treec1cdb7bb10080eb21939accac52b0353108728e5
parent52c517c8f6c199a1d6f5118fae500ef69ea845ae
inputMethod: Check for surrounding text before enabling that capability

While the text input protocol does not have the concept of optional features,
some clients like VTE may lag behind on support for retrieving surrounding
text. This is seen as no surrounding text being set by the client, yet we
invariably enable the SURROUNDING_TEXT capability, giving some IMs the wrong
idea that no text is what there is, thus being free to submit other related
requests like deleting surroundings.

Optionally toggle the SURROUNDING_TEXT capability given the existence of
surrounding text, so that IMs know what to expect on subpar clients. At
a minimum, the surrounding text should be actually the empty string for
empty text fields, on clients that do support it.

Fixes: mutter@27bdf0c577 ("wayland/text-input: Use byte based offset in delete_surrounding_text")
Fixes: mutter@33088d59db ("wayland/text-input: Pass char based offset to ClutterInputFocus")
Fixes: mutter@fb86d5d5b0 ("wayland/text-input: Reset surrounding text values by focus change")
closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3102

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3666>
js/misc/inputMethod.js